﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Admin.Core.Common.Output;
using Admin.Core.Service.TimingTask;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Admin.Core.Controllers.Foreign
{
    /// <summary>
    /// 定时任务
    /// </summary>
    public class TimingTaskController : AreaController
    {
        private readonly ITimingTaskService _timingTaskService;
        
        public TimingTaskController(ITimingTaskService timingTaskService)
        {
            _timingTaskService = timingTaskService;
        }

        /// <summary>
        /// 遍历设备到期时间，发送邮件
        /// </summary>
        /// <param name="tenant">租户</param>
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        public async Task<IResponseOutput> CalSend(int tenant)
        {
            return await _timingTaskService.CalSendAsync(tenant);
        }

    }
}
